﻿using Digitalmes.Model;
using Digitalmes.Model.ProcessManagement;
using Digitalmes.Model.ProductManagement;
using Digitalmes.Model.WmsManagement;
using Microsoft.EntityFrameworkCore;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Text.Json.Serialization;
using WalkingTec.Mvvm.Core;

namespace Digitalmes.Model.ProductManagement
{
    /// <summary>
    /// 产品Bom
    /// </summary>
	[Table("ProductBom")]

    [Display(Name = "_Model.ProductBom")]
    public class ProductBom : BasePoco,IPersistPoco,ITenant
    {
        [Key]
        [Display(Name = "_Model._ProductBom._ID")]
        [Required(ErrorMessage = "Validate.{0}required")]
        public new long ID { get; set; }
        [Display(Name = "_Model._ProductBom._Product")]
        [Comment("产品")]
        public Product Product { get; set; }
        [Display(Name = "_Model._ProductBom._Product")]
        [Comment("产品")]
        public long? ProductId { get; set; }
        [Display(Name = "_Model._ProductBom._ProductName")]
        [Comment("产品名称")]
        public string ProductName { get; set; }
        [Display(Name = "_Model._ProductBom._Material")]
        [Comment("物料")]
        public MaterialDoc Material { get; set; }
        [Display(Name = "_Model._ProductBom._Material")]
        [Comment("物料")]
        public long? MaterialId { get; set; }
        [Display(Name = "_Model._ProductBom._MaterialName")]
        [Comment("物料名称")]
        public string MaterialName { get; set; }
        [Display(Name = "_Model._ProductBom._Qty")]
        [Comment("需求数量")]
        [Precision(18,2)]
        [Required(ErrorMessage = "Validate.{0}required")]
        public decimal? Qty { get; set; }
        [Display(Name = "_Model._ProductBom._Unit")]
        [Comment("单位")]
        public string Unit { get; set; }
        [Display(Name = "_Model._ProductBom._IsValid")]
        [Comment("是否有效")]
        [Required(ErrorMessage = "Validate.{0}required")]
        public bool IsValid { get; set; } = true;

        [Display(Name = "_Model._ProcessResults._OpCode")]
        [Comment("工序编码")]
        public string OpCode { get; set; }

        [Display(Name = "_Model._ProcessResults._Op")]
        [Comment("所属工序")]
        public ProcessRouteItem Op { get; set; }
        [Display(Name = "_Model._ProcessResults._Op")]
        [Comment("所属工序")]
        public long? OpId { get; set; }

        [StringLength(50, ErrorMessage = "Validate.{0}stringmax{1}")]
        public string TenantCode { get; set; }

	}

}
